Skip to content

fix: repair failing tests and type errors across api and shared packages - #111

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2411-1785115394
Open

fix: repair failing tests and type errors across api and shared packages#111
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2411-1785115394

Conversation

@stooit

@stooit stooit commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and eliminates all type errors. bun test22 pass / 0 fail; bunx tsc --noEmitexit 0.

Changes

  • shared/src/utils/pagination.ts — implemented paginate() (was a stub throwing not implemented). Handles page slicing, total/totalPages, out-of-range pages (empty data, truthful metadata), and empty arrays; guards pageSize > 0.
  • api/src/middleware/auth.ts — fixed case-sensitivity bug on public HTTP methods (normalises c.req.method.toUpperCase()), so POST /users is correctly public while PUT/DELETE/PATCH still require a token.
  • api/src/routes/users.ts — added missing badRequest import (was a runtime ReferenceError on invalid POST /users).
  • shared/src/types.ts — aligned User field userNameusername to match tests and all consumers.
  • tsconfig.json — set types: ["bun-types"] so bun:test and process resolve (bun-types already a devDependency; no new deps).

Assumptions

  • Test files not modified (confirmed). Fixes bend source to the tests' expected contract.
  • No new dependencies; no lockfile/manifest changes.
  • Scope kept to exactly what the tests require.

Verification

  • bun test → 22 pass, 0 fail (4 files, 37 assertions)
  • bunx tsc --noEmit → clean
  • Independent review pass confirmed all four seeded bugs fixed with no regression.

- Implement paginate() utility in shared package (was a throwing stub)
- Fix auth middleware case-sensitivity on public HTTP methods (post -> POST, normalise with toUpperCase)
- Add missing badRequest import in users route
- Align shared User type field userName -> username to match tests and consumers
- Set tsconfig types to bun-types so bun:test/process resolve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant